package com.sphd.beautysalon.model;


import com.android.volley.VolleyError;
import com.sphd.beautysalon.interfaces.VolleyJsonObjectCallBack;
import com.sphd.beautysalon.presenter.VipJifenShowPresenterImpl;

import org.json.JSONException;
import org.json.JSONObject;

/**
* Created by Hu on 2016/12/08
*/

public class VipJifenShowModelImpl implements VipJifenShowModel, VolleyJsonObjectCallBack {
    VipJifenShowPresenterImpl vipJifenShowPresenter;
    @Override
    public void sendUrl(String url, VipJifenShowPresenterImpl vipJifenShowPresenter) {
       this.vipJifenShowPresenter=vipJifenShowPresenter;
        volleyUtil.setJsonObjectRequest(url,this);
    }

    @Override
    public void onResponse(JSONObject response) {
        try {
            int res=response.getInt("res");
            vipJifenShowPresenter.sendRes(res);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onErrorResponse(VolleyError error) {
        vipJifenShowPresenter.sendError(error);
    }
}